<include file="Common:header" />
<body>
<table><tr>
<td width="180"><include file="Common:adminpanel" /></td>
<td valign="top" >
<div>
	<form id="form1" name="form1" method="post" action="<{:U('templateeditsave')}>">
		<table width="100%" cellspacing="1" cellpadding="3" border="0">
		
			<tr>
				<td height="30" align="right">添加快递、运费模板：</td>
				<td>（您可以为不同的地区设置不同的收费标准）</td>
			</tr>

			<tr>
				<td height="30" align="right">关联快递公司：</td>
				<td><select name="comid" id="companys"><{:$companys}></select></td>
			</tr>


			<tr>
				<td height="30" align="right">模板名称：</td>
				<td><input type="text" name="tplname" id="tplname" value="<{$tplitem['tplname']}>" /> *如：圆通快递
				</td>
			</tr>
			<tr>
				<td height="30" align="right">起步重量：</td>
				<td><input type="text" name="qbzl" id="qbzl" value="<{$tplitem['startweight']}>" /></td>
			</tr>
			<tr>
				<td height="30" align="right">加价重量：</td>
				<td><input type="text" name="jjzl" id="jjzl" value="<{$tplitem['increaseweight']}>" /></td>
			</tr>
			<tr>
				<td height="30" align="right">默认起步价格：</td>
				<td><input type="text" name="mrjbjg" id="mrjbjg" value="<{$tplitem['startprice']}>" /></td>
			</tr>
			<tr>
				<td height="30" align="right">默认加价：</td>
				<td><input type="text" name="mrjj" id="mrjj" value="<{$tplitem['increaseprice']}>" /></td>
			</tr>
			 
			<tr>
				<td height="30" align="right">&nbsp;</td>
				<td>
				<input type="submit" name="button2" id="button2" value="保存" />
				<input type="button" name="button3" id="button3" value="返回列表" onclick="window.location.href='<{:U('templatelist')}>'" />
				<input type="hidden" name="id" value="<{$tplitem['id']}>">
				</td>
			</tr>
			<tr>
			<td></td>
				<td height="30" >
				<div style="font-family: 微软雅黑,Tahoma; letter-spacing: 2px; display: block;"  id="result"></div>
				</td>
			</tr>
		</table>
		<br /> <br />
	</form>

</div>
</td>
</tr>
</table>
<script> 
$(document).ready(function(){
	$("#companys").children().each( function(i, d) {
		 if( d.value ==  <{$tplitem['comid']}>) {
		     $(this).attr('selected', 'selected'); 
		 }
	} );
	 
	// FROM  Submit 
	
	$('#form1').ajaxForm({
        beforeSubmit:  checkForm,  // pre-submit callback
        success:       complete,  // post-submit callback
        dataType: 'json'
    });
    function checkForm(){
    	/*
        if( '' == $.trim($('#title').val())){
            $('#result').html('标题不能为空').show();
            return false;
        }
    	*/
        //可以在此添加其它判断
    }
    function complete(data){
        if (data.status==1){
            $('#result').html(data.info).show().fadeOut(2000);            
        }else{
            $('#result').html(data.info).show();
        }
    }
			
});

</script>
</body>
</html>